<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_search" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 搜索外购件类目 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="类别" prop="product_type"> 外购件 </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品类别" prop="menu_class">
              <el-radio-group v-model="s_search.menu_class" onClick='javascript:updateFrom(this.value)'>
                <el-radio-button label="外购件">外购件</el-radio-button>
                <el-radio-button label="服务性外购件">服务性外购件</el-radio-button>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="外购件分类" prop="product_classid">
              <el-select style='width:100%' v-model="s_search.product_classid">
                <el-option label="－－无－－" value='' />
                <el-option v-for="dict in l_class" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="所属供应商" prop="">
              {{s_search.product_client}}
              <el-button @click="popProductBuySupplier('','product_client')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="产品名称" prop="product_name">
              <el-input v-model="s_search.product_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="缩写" prop="product_namebar">
              <el-input v-model="s_search.product_namebar" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="产品型号" prop="product_model">
              <el-input v-model="s_search.product_model" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="产品规格" prop="product_norm">
              <el-input v-model="s_search.product_norm" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
      <el-button @click="gotoPage('/psi/product/ProductBuySearchs?'+vueparams+'')" type='primary' size="mini">清除</el-button>
    </el-form>
    <el-dialog :visible.sync="ProductBuySupplierVisible" append-to-body>
      <ProductBuySupplier v-if="ProductBuySupplierVisible" ref="ProductBuySupplier" :popparams="popparams"> </ProductBuySupplier>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductBuySupplier from "@/views/psi/product/ProductBuySupplier";
  export default {
    name: 'ProductBuySearchs',
    components: {
      ProductBuySupplier,
    },
    props: ['popparams'],
    data() {
      return {
        ProductBuySupplierVisible: false,
        ProductBuySupplierValue: null,
        ProductBuySupplierDesc: null,
        vueparams: this.getVUEParams(""),
        s_search: {
          product_type: null,
          menu_class: null,
          product_classid: null,
          product_client: null,
          product_name: null,
          product_namebar: null,
          product_model: null,
          product_norm: null,
        },
        l_class: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/product/ProductSail/productBuySearchs?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popProductBuySupplier(desc, value) {
        this.ProductBuySupplierVisible = true;
        this.ProductBuySupplierDesc = desc;
        this.ProductBuySupplierValue = value;
      },
      closeProductBuySupplier(value, desc) {
        this.ProductBuySupplierVisible = false;
        this.$set(this.s_search, this.ProductBuySupplierDesc, desc);
        this.$set(this.s_search, this.ProductBuySupplierValue, value);
      },
    },
  }
</script>
